<?php
include_once 'utilidades/BD_MySQL.php';
class ReporteBD{
	private $bd = null;
	private $error = null;
	
	public function ReporteBD(){
		$this->bd = new BD_MySQL();
		$this->error = $this->bd->getError();
	}	
	
	private function guardarApp($nombreApp) {
		$query = '';
		$filas = $this->bd->query($query,BD_MySQL::FETCH_ROW);
		$this->error = $this->bd->getError();
		if($this->error->noHayError()){
			return $filas[0][0];
		}		
		return false;
	}
	
	public function guardarArrApps($arrNomApps) {	
		$arrIDsApps = array();	
		foreach ($arrNomApps as $nomApp) {
			$idApp = $this->guardarApp($nomApp);			
			if($this->error->noHayError()){
				$arrIDsApps[$nomApp] = $idApp;
			}
			else{
				return false;
			}
		}
		return $arrIDsApps;
	}	
	
	public function getError() {
		return $this->error;
	}
	
}